<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    @keyframes size-animation {
      from {
        width: 100px;
        height: 100px;
      }

      to {
        width: 300px;
        height: 300px;
      }
    }

    div {
      width: 100px;
      height: 100px;
      background-color: #17f;
      animation-name: size-animation;
      animation-duration: 1s;
      animation-timing-function: linear;
      animation-iteration-count: infinite;
      animation-direction: alternate;

      /*
        播放的状态
         ● running
         ● paused
       */
      animation-play-state: running;
    }

    div:hover {
      animation-play-state: paused;
    }
  </style>
</head>

<body>
  <div></div>
</body>

</html>